﻿using System.Windows;
using hStatsC.Models;
using Panuon.UI.Silver;
using PropertyChanged;

namespace hStatsC.Views
{
    [AddINotifyPropertyChangedInterface]
    public partial class AppDetailsView : Window
    {
        public bool isNew { get; set; }

        public AppInfo App { get; set; } = new();

        public AppDetailsView(bool isnew)
        {
            InitializeComponent();
            isNew = isnew;
            if (isNew)
            {
                DataContext = this.App;
                this.App.AccessToken = "提交后生成";
            }
        }

        private void Btn_OK(object sender, RoutedEventArgs e)
        {
            if (isNew)
            {
                if (this.App.App != "")
                {
                    DialogResult=true;
                    this.Close();
                }else
                {
                    MessageBoxX.Show("部分参数为空", "错误!");
                }
            }
            else
            {
                this.Close();
            }
        }
    }
}